/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/***********************************************************************************************************************
 * Includes
 **********************************************************************************************************************/
#include "r_rsip_primitive.h"
#include "r_rsip_util.h"

/***********************************************************************************************************************
 * Global variables
 **********************************************************************************************************************/

uint32_t         S_RAM[RSIP_PRV_WORD_SIZE_S_RAM];
uint32_t         S_HEAP[RSIP_PRV_WORD_SIZE_S_HEAP];
uint32_t         S_INST[RSIP_PRV_WORD_SIZE_S_INST];
uint32_t const * S_INST2;

uint32_t const s_flash[] =
{
    BSWAP_32BIG_C(0xeb64faa1U), BSWAP_32BIG_C(0x3f841da8U), BSWAP_32BIG_C(0xdab9d921U), BSWAP_32BIG_C(0xecb28c66U),
    BSWAP_32BIG_C(0x94b6c754U), BSWAP_32BIG_C(0x9fdd8027U), BSWAP_32BIG_C(0x01aea8beU), BSWAP_32BIG_C(0xf3bd25beU),
    BSWAP_32BIG_C(0x6b05cba5U), BSWAP_32BIG_C(0xa4a510c3U), BSWAP_32BIG_C(0x2346da15U), BSWAP_32BIG_C(0x2cd90905U),
    BSWAP_32BIG_C(0xdadc869dU), BSWAP_32BIG_C(0xb7ff2bfeU), BSWAP_32BIG_C(0x9ec0b299U), BSWAP_32BIG_C(0xde7b73cfU),
    BSWAP_32BIG_C(0x4fb15f6fU), BSWAP_32BIG_C(0x8b0d201eU), BSWAP_32BIG_C(0xf79a09d7U), BSWAP_32BIG_C(0xff2d22f7U),
    BSWAP_32BIG_C(0x2ba1a18aU), BSWAP_32BIG_C(0x373fd91bU), BSWAP_32BIG_C(0xa9441c86U), BSWAP_32BIG_C(0x95dd0405U),
    BSWAP_32BIG_C(0xd61dae52U), BSWAP_32BIG_C(0x17029455U), BSWAP_32BIG_C(0x9e1eebafU), BSWAP_32BIG_C(0xf0fa7da1U),
    BSWAP_32BIG_C(0x8858f15cU), BSWAP_32BIG_C(0x307c4f7bU), BSWAP_32BIG_C(0x24d0da84U), BSWAP_32BIG_C(0x0305e734U),
    BSWAP_32BIG_C(0x86dbae4cU), BSWAP_32BIG_C(0xb1f25f0eU), BSWAP_32BIG_C(0xafe601ffU), BSWAP_32BIG_C(0x8de82bc1U),
    BSWAP_32BIG_C(0x4b30290aU), BSWAP_32BIG_C(0x8f04efe7U), BSWAP_32BIG_C(0x8a1a297eU), BSWAP_32BIG_C(0x167e5d3eU),
    BSWAP_32BIG_C(0x9e18761eU), BSWAP_32BIG_C(0x1683d7f2U), BSWAP_32BIG_C(0x5c2a738aU), BSWAP_32BIG_C(0xf7d72e64U),
    BSWAP_32BIG_C(0x88332b51U), BSWAP_32BIG_C(0x9acb649cU), BSWAP_32BIG_C(0xe47402a2U), BSWAP_32BIG_C(0x16894a98U),
    BSWAP_32BIG_C(0x0058f9d0U), BSWAP_32BIG_C(0x776916faU), BSWAP_32BIG_C(0x7f2cf792U), BSWAP_32BIG_C(0xe2112741U),
    BSWAP_32BIG_C(0x5c1985b8U), BSWAP_32BIG_C(0xa4a6a595U), BSWAP_32BIG_C(0x7f9fbc4eU), BSWAP_32BIG_C(0x0adf7f28U),
    BSWAP_32BIG_C(0x77e88505U), BSWAP_32BIG_C(0x35767b37U), BSWAP_32BIG_C(0x9d4ce355U), BSWAP_32BIG_C(0xdba866d1U),
    BSWAP_32BIG_C(0xda5895baU), BSWAP_32BIG_C(0xebd32d6fU), BSWAP_32BIG_C(0xec1162c1U), BSWAP_32BIG_C(0x068e7f17U),
    BSWAP_32BIG_C(0x186ec07dU), BSWAP_32BIG_C(0x4c7a9123U), BSWAP_32BIG_C(0x65656d3dU), BSWAP_32BIG_C(0x0f0b7bd2U),
    BSWAP_32BIG_C(0x7a946bffU), BSWAP_32BIG_C(0xa8531a5aU), BSWAP_32BIG_C(0x64a270feU), BSWAP_32BIG_C(0xdbf17469U),
    BSWAP_32BIG_C(0xca429a5fU), BSWAP_32BIG_C(0xb6d061d5U), BSWAP_32BIG_C(0xe4ecd4bbU), BSWAP_32BIG_C(0x2d2edd86U),
    BSWAP_32BIG_C(0x9512836fU), BSWAP_32BIG_C(0x07ab8bc7U), BSWAP_32BIG_C(0xbf78065cU), BSWAP_32BIG_C(0xe801de67U),
    BSWAP_32BIG_C(0x5ce684d2U), BSWAP_32BIG_C(0x7089ed8aU), BSWAP_32BIG_C(0xdba8772eU), BSWAP_32BIG_C(0xc194ea0eU),
    BSWAP_32BIG_C(0x4770fcafU), BSWAP_32BIG_C(0x0af94b5cU), BSWAP_32BIG_C(0x7335aa90U), BSWAP_32BIG_C(0x9224743dU),
    BSWAP_32BIG_C(0xb4d3d4b0U), BSWAP_32BIG_C(0x9f514a5fU), BSWAP_32BIG_C(0x8f7d1c54U), BSWAP_32BIG_C(0x51ecb8fcU),
    BSWAP_32BIG_C(0x6a50cffdU), BSWAP_32BIG_C(0x090fb7b3U), BSWAP_32BIG_C(0xe337cefcU), BSWAP_32BIG_C(0x55c5ca68U),
    BSWAP_32BIG_C(0x2e062fdeU), BSWAP_32BIG_C(0x1a621140U), BSWAP_32BIG_C(0x15e7352fU), BSWAP_32BIG_C(0x668e9d7dU),
    BSWAP_32BIG_C(0x5ef950ecU), BSWAP_32BIG_C(0x862c0622U), BSWAP_32BIG_C(0x3f880ebeU), BSWAP_32BIG_C(0x71f7614dU),
    BSWAP_32BIG_C(0x1e7d4d3bU), BSWAP_32BIG_C(0x08c4d8c8U), BSWAP_32BIG_C(0xce62ddc0U), BSWAP_32BIG_C(0x8e41ee2dU),
    BSWAP_32BIG_C(0xba352037U), BSWAP_32BIG_C(0xefc87d99U), BSWAP_32BIG_C(0x4b326400U), BSWAP_32BIG_C(0xfb110636U),
    BSWAP_32BIG_C(0x7b8c54f4U), BSWAP_32BIG_C(0x574e12a8U), BSWAP_32BIG_C(0x787f358aU), BSWAP_32BIG_C(0x917a9d40U),
    BSWAP_32BIG_C(0x972e855aU), BSWAP_32BIG_C(0xeb6855d3U), BSWAP_32BIG_C(0xdd60ea20U), BSWAP_32BIG_C(0x6bbf84ebU),
    BSWAP_32BIG_C(0xe2120c57U), BSWAP_32BIG_C(0xe2271b19U), BSWAP_32BIG_C(0x8ac44a9cU), BSWAP_32BIG_C(0x9b4c9beeU),
    BSWAP_32BIG_C(0x1fd02886U), BSWAP_32BIG_C(0x8655cdbeU), BSWAP_32BIG_C(0x1371082fU), BSWAP_32BIG_C(0xaac58378U),
    BSWAP_32BIG_C(0x048b03c3U), BSWAP_32BIG_C(0x8533751fU), BSWAP_32BIG_C(0x67d26531U), BSWAP_32BIG_C(0xbea46ef4U),
    BSWAP_32BIG_C(0x0dcb5dcbU), BSWAP_32BIG_C(0x8a10c332U), BSWAP_32BIG_C(0x9a41d898U), BSWAP_32BIG_C(0x31718aeaU),
    BSWAP_32BIG_C(0xda58d536U), BSWAP_32BIG_C(0x3bcafb1cU), BSWAP_32BIG_C(0xf71f54b6U), BSWAP_32BIG_C(0x5e42ed28U),
    BSWAP_32BIG_C(0x0c3b10a5U), BSWAP_32BIG_C(0x802eb260U), BSWAP_32BIG_C(0x01681a41U), BSWAP_32BIG_C(0x0f7a77deU),
    BSWAP_32BIG_C(0x782c1051U), BSWAP_32BIG_C(0x0a6296a2U), BSWAP_32BIG_C(0xf4272381U), BSWAP_32BIG_C(0xb610c741U),
    BSWAP_32BIG_C(0x82865092U), BSWAP_32BIG_C(0x879b4060U), BSWAP_32BIG_C(0x329629a5U), BSWAP_32BIG_C(0x2119fc64U),
    BSWAP_32BIG_C(0x9e6d99e6U), BSWAP_32BIG_C(0xed4095aaU), BSWAP_32BIG_C(0xd202b21aU), BSWAP_32BIG_C(0xe93da8feU),
    BSWAP_32BIG_C(0x832be2e0U), BSWAP_32BIG_C(0xaa061b41U), BSWAP_32BIG_C(0x94216498U), BSWAP_32BIG_C(0xccaae411U),
    BSWAP_32BIG_C(0xe427c24bU), BSWAP_32BIG_C(0x7012f7ebU), BSWAP_32BIG_C(0x60f1fcd3U), BSWAP_32BIG_C(0xb66d4fd7U),
    BSWAP_32BIG_C(0x29225418U), BSWAP_32BIG_C(0xf181578bU), BSWAP_32BIG_C(0x4f10ec03U), BSWAP_32BIG_C(0xdb2d9dcaU),
    BSWAP_32BIG_C(0xc7ac797dU), BSWAP_32BIG_C(0x8306f7eeU), BSWAP_32BIG_C(0xd6641be9U), BSWAP_32BIG_C(0x448afe03U),
    BSWAP_32BIG_C(0x94f3134dU), BSWAP_32BIG_C(0xc543b618U), BSWAP_32BIG_C(0xc38b9379U), BSWAP_32BIG_C(0xcbc1292bU),
    BSWAP_32BIG_C(0xaed2e0ffU), BSWAP_32BIG_C(0x782898a1U), BSWAP_32BIG_C(0x7c1d6a91U), BSWAP_32BIG_C(0x3eb84a0cU),
    BSWAP_32BIG_C(0x19b74b8fU), BSWAP_32BIG_C(0x69c3b1d4U), BSWAP_32BIG_C(0x925a9781U), BSWAP_32BIG_C(0xe6a9d686U),
    BSWAP_32BIG_C(0x20edc926U), BSWAP_32BIG_C(0x2a90cd17U), BSWAP_32BIG_C(0x1212c39aU), BSWAP_32BIG_C(0xd22c22ddU),
    BSWAP_32BIG_C(0xaa688d26U), BSWAP_32BIG_C(0x835a0036U), BSWAP_32BIG_C(0x7f02fc15U), BSWAP_32BIG_C(0xd7751ce3U),
    BSWAP_32BIG_C(0xda06bdc1U), BSWAP_32BIG_C(0x39e081ecU), BSWAP_32BIG_C(0x1d7b3056U), BSWAP_32BIG_C(0x8dc4c832U),
    BSWAP_32BIG_C(0x0b9805c5U), BSWAP_32BIG_C(0x7df25c28U), BSWAP_32BIG_C(0x37d5ab7aU), BSWAP_32BIG_C(0x45adbce3U),
    BSWAP_32BIG_C(0x829166fdU), BSWAP_32BIG_C(0x43931599U), BSWAP_32BIG_C(0xaa5b1046U), BSWAP_32BIG_C(0xe908185cU),
    BSWAP_32BIG_C(0x0fe80705U), BSWAP_32BIG_C(0x2de9c8a3U), BSWAP_32BIG_C(0x0b488d06U), BSWAP_32BIG_C(0xdd7bc9d3U),
    BSWAP_32BIG_C(0xcf099fc2U), BSWAP_32BIG_C(0x5043a6b3U), BSWAP_32BIG_C(0x27f8c706U), BSWAP_32BIG_C(0xcd015f16U),
    BSWAP_32BIG_C(0x809ae0bfU), BSWAP_32BIG_C(0xacb2789eU), BSWAP_32BIG_C(0xaaedfbd5U), BSWAP_32BIG_C(0x0cc5082bU),
    BSWAP_32BIG_C(0x8aa106b0U), BSWAP_32BIG_C(0x0aacf260U), BSWAP_32BIG_C(0xab1d8d5aU), BSWAP_32BIG_C(0x640dff27U),
    BSWAP_32BIG_C(0x7b095e34U), BSWAP_32BIG_C(0xa216baf9U), BSWAP_32BIG_C(0x25f065a1U), BSWAP_32BIG_C(0x962e21ddU),
    BSWAP_32BIG_C(0x27d3804cU), BSWAP_32BIG_C(0x508b28cbU), BSWAP_32BIG_C(0xd3ec5fa2U), BSWAP_32BIG_C(0x22f6f78cU),
    BSWAP_32BIG_C(0xf387d8afU), BSWAP_32BIG_C(0x71658ea3U), BSWAP_32BIG_C(0x635599c9U), BSWAP_32BIG_C(0xa1c2c47fU),
    BSWAP_32BIG_C(0x61eb90ebU), BSWAP_32BIG_C(0xb135f630U), BSWAP_32BIG_C(0xd180a7f7U), BSWAP_32BIG_C(0x855087a7U),
    BSWAP_32BIG_C(0xd193434aU), BSWAP_32BIG_C(0x94345d73U), BSWAP_32BIG_C(0x5c7db513U), BSWAP_32BIG_C(0xe2ccf3e7U),
    BSWAP_32BIG_C(0xa1a72b59U), BSWAP_32BIG_C(0x3d85a686U), BSWAP_32BIG_C(0x7ba15735U), BSWAP_32BIG_C(0x211d2fcfU),
    BSWAP_32BIG_C(0xbd3c18b4U), BSWAP_32BIG_C(0xdfd58f27U), BSWAP_32BIG_C(0x67208965U), BSWAP_32BIG_C(0xd2524cc0U),
    BSWAP_32BIG_C(0x22f26039U), BSWAP_32BIG_C(0x0843378dU), BSWAP_32BIG_C(0x74330ec0U), BSWAP_32BIG_C(0x1994e335U),
    BSWAP_32BIG_C(0x65f05bb2U), BSWAP_32BIG_C(0xd9908ba7U), BSWAP_32BIG_C(0x8a6aad43U), BSWAP_32BIG_C(0x68a1fcb3U),
    BSWAP_32BIG_C(0xd8b4458cU), BSWAP_32BIG_C(0x82f3ab4aU), BSWAP_32BIG_C(0xdddd01ddU), BSWAP_32BIG_C(0xb9abfd19U),
    BSWAP_32BIG_C(0x429c7cc1U), BSWAP_32BIG_C(0x790c20f4U), BSWAP_32BIG_C(0xf9296efeU), BSWAP_32BIG_C(0x5dbb2bb0U),
    BSWAP_32BIG_C(0x60ba41b7U), BSWAP_32BIG_C(0x9bcd16caU), BSWAP_32BIG_C(0xd735443cU), BSWAP_32BIG_C(0x183b6e92U),
    BSWAP_32BIG_C(0x72b7e67aU), BSWAP_32BIG_C(0x1aa6978dU), BSWAP_32BIG_C(0x07115796U), BSWAP_32BIG_C(0x2dbe69b4U),
    BSWAP_32BIG_C(0x012ca826U), BSWAP_32BIG_C(0x5f5242eaU), BSWAP_32BIG_C(0x3651b6e9U), BSWAP_32BIG_C(0xbdcca07dU),
    BSWAP_32BIG_C(0x49f99c51U), BSWAP_32BIG_C(0xacb21b48U), BSWAP_32BIG_C(0x0a73922cU), BSWAP_32BIG_C(0x021802ddU),
    BSWAP_32BIG_C(0x42e89abcU), BSWAP_32BIG_C(0xdc87c276U), BSWAP_32BIG_C(0xc1a4cfd4U), BSWAP_32BIG_C(0xa3894145U),
    BSWAP_32BIG_C(0xc26897a9U), BSWAP_32BIG_C(0x6e939343U), BSWAP_32BIG_C(0x93f72041U), BSWAP_32BIG_C(0x65ff99d6U),
};
